package cn.yunyichina.provider.sb.util;

import cn.yunyichina.provider.sb.constant.Constant;
import cn.yunyichina.provider.sb.entity.MedicalInvoiceNo;
import cn.yunyichina.provider.sb.entity.MedicalPatient;
import cn.yunyichina.provider.sb.vo.*;
import com.alibaba.dubbo.common.utils.StringUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.internal.util.AlipayEncrypt;
import com.alipay.api.request.AlipayCommerceDataSendRequest;
import com.alipay.api.response.AlipayCommerceDataSendResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by 15-AK on 2017/7/13.
 */
public class Util {
    private static final Logger logger = LoggerFactory.getLogger(Util.class);

    public static void main(String[] args) throws AlipayApiException {
        System.out.println(conveterIntToDouble(null));
//        String kk = "g1Ub+BfwuI6u/bpR4pWSfwA48JAJMtdeFGVdJ1hzUW/oiTGtTU9OUsb1oaJFu2gO1WVWSrar5Spaw0FgoqBgl28XMgHWftYWi1nZ/o1pnJ30WS4x71maxiKFTdSItwsyP3/KetjKEqlByNafG8UB8APX+soyB7OOun7jVlSuhqMxhFndLDgRDOxzFQ9xLAF3Z+9p2LDHnd0nWt6PsEyGNRcOIX2oToGtKuGAPEwRdSsSdRzpCFBS2BP1x4D1oEcYX+Uxj65RjnhoN0wFxsV8AXEHhx4OS/mHlNaye6FGi7sc0LjFfHI0lGeikMTKMITrBCdLDRWyS49qkki9H3fUfGbXIN/wlOZuZHiyJqDIwLTbeyWtSdAr8uX6Y+B4E7fiB6r2I4D/aCy+6M+s+CAE1AB9Z2X5fu26EF08TtOsk3o9KenMbpHLOpV6y9jXO+EgAUDLRmSpDwgl1LcVLJIf1iHbQyHf4cn4P5tsIX79kTjnkIRcEAvl5M/Z60KlL7PuORnbhHgkSFx9jb5Lg7LXi3ChTXMt5a9IvCtavICIACEGfnbNOwyj+xe5v2niltxy/ljJh5YIFmBpLMCIsDNl4HyFiG523Kb6a+qdQDgvtWxBsx7/TJ9IWAbP/AvhRfXaJjaAOx9mv8lazXtj6XwYvkDIr6vhewmqWM4bYzk4iE9erUpGVe/mrx9U9s1b2NGX1I2eQMRktRa/YBFGBl0C43kF8vY2GGGbs2F3lxCwKRwudQq0WuO28hr/IeUqW0juRdGin8XG8rFViuFcUNp5tvEtyZYXNBrJsCMiArIsBbTLuIz3eWGJpjtQV5FVdO/clYarfttYfQ02LsQrEHljghKxvthn8n6x/4GQGu0pxok+nBz9HzqY05EjCPSa+LZyqBkrR1nQDjxhxbVsjd8ptSMH0Sm+vfRMWhrPH5qLF/Zf4xS8702RONOD12/mbm9dWtuNjeOx6TALxmK8NTQ9TmJSnWL8lchBAWsmdcy7rc3a1CcKaKQxOjHQr0s2CDKYbKBuPNq4DatWeS8YijEg5uigfz5smPUMvWfW6DoefBUxbpuJOZ1KcJthPeQsZBftPpMaSNxQpO1UDxMBRaj5nW/qOrd3xkTN+nJxs/JOMqCXDODuEJHlTmchqlR8rkuc";
//        String decodeData = AlipayEncrypt.decryptContent(kk, "AES", Constant.ENCRYPT_KEY, "utf8");
//        System.out.println(decodeData + "----");
    }

    public static String encryptMedicalPatient(MedicalPatientVo medicalPatientVo, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);
        info.put("patient_id", medicalPatientVo.getPatientId());
        info.put("patient_name", medicalPatientVo.getPatientName());
        info.put("patient_type", medicalPatientVo.getPatientType());
        info.put("hospital_id", medicalPatientVo.getHospitalId());
        info.put("visit_date", medicalPatientVo.getVisitDate());
        info.put("medical_category", medicalPatientVo.getMedicalCategory());
        info.put("country", medicalPatientVo.getCountry());
        info.put("nation", medicalPatientVo.getNation());
        info.put("origo_place", medicalPatientVo.getOrigoPlace());
        info.put("marital_status", medicalPatientVo.getMaritalStatus());
        info.put("ins_type", medicalPatientVo.getInsType());
        info.put("cert_type", medicalPatientVo.getCertType() == 1 ? "01" : medicalPatientVo.getCertType());
        info.put("cert_no", medicalPatientVo.getCertNo());
        info.put("email", medicalPatientVo.getEmail());
        info.put("self_telephone", medicalPatientVo.getSelfTelephone());
        info.put("partner_telephone", medicalPatientVo.getPartnerTelephone());
        info.put("family_telephone", medicalPatientVo.getFamilyTelephone());
        info.put("family_address", medicalPatientVo.getFamilyAddress());
        info.put("family_post_code", medicalPatientVo.getFamilyPostCode());
        info.put("censue_address", medicalPatientVo.getCensueAddress());
        info.put("work_company", medicalPatientVo.getWorkcompany());
        info.put("work_telephone", medicalPatientVo.getWorkTelephone());
        info.put("contact_name", medicalPatientVo.getContactName());
        info.put("contact_telephone", medicalPatientVo.getContactTelephone());
        info.put("contact_address", medicalPatientVo.getContactAddress());
        info.put("contact_relationship", medicalPatientVo.getContactRelationship());
        info.put("guardian_telephone", medicalPatientVo.getGuardianTelephone());
        info.put("guardian_name", medicalPatientVo.getGuardianName());
        info.put("guardion_cert_type", medicalPatientVo.getGuardionCertType());
        info.put("guardion_cert_no", medicalPatientVo.getGuardionCertNo());
        info.put("serial_no", medicalPatientVo.getSerialNo());
        info.put("rows", medicalPatientVo.getTotalRows());
        info.put("offset", medicalPatientVo.getCurrentOffset());
        info.put("medical_type", medicalPatientVo.getMedicalType() == 1 ? "O" : "I");
        info.put("hospital_name", medicalPatientVo.getHospitalName());

        String beforeEncryptData = sceneData.toJSONString();
        logger.info("patIdNo={},就诊人信息beforeEncryptData={}", medicalPatientVo.getCertNo(),beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }


    public static String encryptMedicalOutpatientDiagnosis(MedicalOutpatientDiagnosisVo medicalOutpatientDiagnosisVo, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);
        info.put("case_no", medicalOutpatientDiagnosisVo.getCaseNo());
        info.put("outpatient_serial_no", medicalOutpatientDiagnosisVo.getOutpatientSerialNo());
        info.put("patient_id", medicalOutpatientDiagnosisVo.getPatientId());
        info.put("medical_category", medicalOutpatientDiagnosisVo.getMedicalCategory());
        info.put("patient_charge_type", medicalOutpatientDiagnosisVo.getPatientChargeType());
        info.put("register_date", medicalOutpatientDiagnosisVo.getRegisterDate());
        info.put("visit_date", medicalOutpatientDiagnosisVo.getVisitDate());
        info.put("hospital_no", medicalOutpatientDiagnosisVo.getHospitalNo());
        info.put("hospital_name", medicalOutpatientDiagnosisVo.getHospitalName());
        info.put("medical_hierarchy", medicalOutpatientDiagnosisVo.getMedicalHierarchy());
        info.put("medical_institution_type", medicalOutpatientDiagnosisVo.getMedicalInstitutionType());
        info.put("visit_dept_no", medicalOutpatientDiagnosisVo.getVisitDeptNo());
        info.put("visit_dept_name", medicalOutpatientDiagnosisVo.getVisitDeptName());
        info.put("disease_name", medicalOutpatientDiagnosisVo.getDiseaseName());
        info.put("disease_no", medicalOutpatientDiagnosisVo.getDiseaseNo());
        info.put("medical_history_statement", medicalOutpatientDiagnosisVo.getMedicalHistoryStatement());
        info.put("main_suit", medicalOutpatientDiagnosisVo.getMainSuit());

        info.put("present_disease_history", medicalOutpatientDiagnosisVo.getPresentDiseaseHistory());
        info.put("anamnesis", medicalOutpatientDiagnosisVo.getAnamnesis());
        info.put("obstetrical_history", medicalOutpatientDiagnosisVo.getObstetricalHistory());
        info.put("personal_history", medicalOutpatientDiagnosisVo.getPersonalHistory());
        info.put("family_history", medicalOutpatientDiagnosisVo.getFamilyHistory());
        info.put("allergic_history", medicalOutpatientDiagnosisVo.getAllergicHistory());
        info.put("menstrual_history", medicalOutpatientDiagnosisVo.getMenstrualHistory());
        info.put("physical_check", medicalOutpatientDiagnosisVo.getPhysicalCheck());

        info.put("speciality_check", medicalOutpatientDiagnosisVo.getSpecialityCheck());
        info.put("accessory_check", medicalOutpatientDiagnosisVo.getAccessoryCheck());
        info.put("treat_recormend", medicalOutpatientDiagnosisVo.getTreatRecormend());
        info.put("emergency_observation_record", medicalOutpatientDiagnosisVo.getEmergencyObservationRecord());
        info.put("emergency _record", medicalOutpatientDiagnosisVo.getEmergencyRecord());
        info.put("electronic_medical_records", medicalOutpatientDiagnosisVo.getElectronicMedicalRecords());
        info.put("diagnostician_no", medicalOutpatientDiagnosisVo.getDiagnosticianNo());
        info.put("diagnostician_name", medicalOutpatientDiagnosisVo.getDiagnosticianName());

        info.put("medical_diagnosis_no", medicalOutpatientDiagnosisVo.getMedicalDiagnosisNo());
        info.put("medical_diagnosis_name", medicalOutpatientDiagnosisVo.getMedicalDiagnosisName());
        info.put("rows", medicalOutpatientDiagnosisVo.getTotalRows());
        info.put("offset", medicalOutpatientDiagnosisVo.getCurrentOffset());

        String beforeEncryptData = sceneData.toJSONString();
        logger.info("mzFeeId={},门诊诊断信息加密前数据beforeEncryptData={}",medicalOutpatientDiagnosisVo.getOutpatientSerialNo(), beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }

    public static String encryptMedicalOutpatientFeeVo(MedicalOutpatientFeeVo medicalOutpatientFeeVo, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);

        info.put("outpatient_serial_no", medicalOutpatientFeeVo.getOutpatientSerialNo());
        info.put("refund_serial_no", medicalOutpatientFeeVo.getRefundSerialNo());
        info.put("social_security_no", medicalOutpatientFeeVo.getSocialSecurityNo());
        info.put("ins_type", medicalOutpatientFeeVo.getInsType());
        info.put("invoice_no", medicalOutpatientFeeVo.getInvoiceNo());
        info.put("directory_category", medicalOutpatientFeeVo.getDirectoryCategory());

        info.put("medical_expense_settlement_mode_name", medicalOutpatientFeeVo.getMedicalExpenseSettlementModeName());
        info.put("medical_expense_settlement_mode_no", medicalOutpatientFeeVo.getMedicalExpenseSettlementModeNo());
        info.put("total_invoice", conveterIntToDouble(medicalOutpatientFeeVo.getTotalInvoice()));
        info.put("total_self_expense", conveterIntToDouble(medicalOutpatientFeeVo.getTotalSelfExpense()));
        info.put("total_self_care_expense", conveterIntToDouble(medicalOutpatientFeeVo.getTotalSelfCareExpense()));
        info.put("overall_payment_expense", conveterIntToDouble(medicalOutpatientFeeVo.getOverallPaymentExpense()));
        info.put("large_payment_expense", conveterIntToDouble(medicalOutpatientFeeVo.getLargePaymentExpense()));
        info.put("overall_fund_expenditure", conveterIntToDouble(medicalOutpatientFeeVo.getOverallFundExpenditure()));

        info.put("previous_account_payment", conveterIntToDouble(medicalOutpatientFeeVo.getPreviousAccountPayment()));
        info.put("current_account_payment", conveterIntToDouble(medicalOutpatientFeeVo.getCurrentAccountBalance()));
        info.put("civil_subsidy_payment", conveterIntToDouble(medicalOutpatientFeeVo.getCivilSubsidyPayment()));
        info.put("personal_conceit", conveterIntToDouble(medicalOutpatientFeeVo.getPersonalConceit()));
        info.put("personal_cash_payment", conveterIntToDouble(medicalOutpatientFeeVo.getPersonalCashPayment()));
        info.put("current_account_balance", conveterIntToDouble(medicalOutpatientFeeVo.getCurrentAccountBalance()));
        info.put("previous_account_balance", conveterIntToDouble(medicalOutpatientFeeVo.getPreviousAccountBalance()));
        info.put("serious_illness_compliance_expense", conveterIntToDouble(medicalOutpatientFeeVo.getSeriousIllnessComplianceExpense()));
        info.put("difficult_relief_fund_payment", conveterIntToDouble(medicalOutpatientFeeVo.getDifficultReliefFundPayment()));
        info.put("model_worker_fund_payment", conveterIntToDouble(medicalOutpatientFeeVo.getModelWorkerFundPayment()));
        info.put("health_fund_payment", conveterIntToDouble(medicalOutpatientFeeVo.getHealthFundPayment()));
        info.put("prompt_message", medicalOutpatientFeeVo.getPromptMessage());

        info.put("old_worker_fund_payment", conveterIntToDouble(medicalOutpatientFeeVo.getOldWorkerFundPayment()));
        info.put("hospital_commitment", conveterIntToDouble(medicalOutpatientFeeVo.getHospitalCommitment()));
        info.put("other_fund_payment", conveterIntToDouble(medicalOutpatientFeeVo.getOtherFundPayment()));
        info.put("collection_date", medicalOutpatientFeeVo.getCollectionDate());
        info.put("collection_unit", medicalOutpatientFeeVo.getCollectionUnit());
        info.put("toller", medicalOutpatientFeeVo.getToller());
        info.put("invoice_type",medicalOutpatientFeeVo.getInvoiceType());
        info.put("case_no", medicalOutpatientFeeVo.getCaseNo());
        info.put("pay_no", medicalOutpatientFeeVo.getPayNo());
        info.put("rows", medicalOutpatientFeeVo.getTotalRows());
        info.put("offset", medicalOutpatientFeeVo.getCurrentOffset());

        String beforeEncryptData = sceneData.toJSONString();
        logger.info("mzFeeId={},门诊费用列表加密前数据beforeEncryptData={}",  medicalOutpatientFeeVo.getOutpatientSerialNo(),beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }

    public static String encryptMedicalOutpatientFeeDetailVo(MedicalOutpatientFeeDetailVo medicalOutpatientFeeDetailVo, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);

        info.put("document_no", medicalOutpatientFeeDetailVo.getDocumentNo());
        info.put("outpatient_serial_no", medicalOutpatientFeeDetailVo.getOutpatientSerialNo());
        info.put("pay_no", medicalOutpatientFeeDetailVo.getPayNo());
        info.put("expense_detail_item_name", medicalOutpatientFeeDetailVo.getExpenseDetailItemName());
        info.put("expense_detail_item_no", medicalOutpatientFeeDetailVo.getExpenseDetailItemNo());
        info.put("expense_detail_unit", medicalOutpatientFeeDetailVo.getExpenseDetailUnit());
        info.put("expense_detail_spec", medicalOutpatientFeeDetailVo.getExpenseDetailSpec());
        info.put("expense_detail_univalent", conveterIntToDouble(medicalOutpatientFeeDetailVo.getExpenseDetailUnivalent()));

        info.put("expense_detail_quantity", medicalOutpatientFeeDetailVo.getExpenseDetailQuantity());
        info.put("expense_detail_amount", conveterIntToDouble(medicalOutpatientFeeDetailVo.getExpenseDetailAmount()));
        info.put("total_expense", conveterIntToDouble(medicalOutpatientFeeDetailVo.getTotalExpense()));
        info.put("self_payment_ratio", medicalOutpatientFeeDetailVo.getSelfPaymentRatio());


        info.put("item_spec", medicalOutpatientFeeDetailVo.getItemSpec());
        info.put("item_dosage_form", medicalOutpatientFeeDetailVo.getItemDosageForm());
        info.put("item_unit", medicalOutpatientFeeDetailVo.getItemUnit());
        info.put("item_origin_name", medicalOutpatientFeeDetailVo.getItemOriginName());
        info.put("package_quantity", medicalOutpatientFeeDetailVo.getPackageQuantity());
        info.put("package_unit", medicalOutpatientFeeDetailVo.getPackageUnit());
        info.put("min_dosage_unit", medicalOutpatientFeeDetailVo.getMinDosageUnit());
        info.put("single_dosage", medicalOutpatientFeeDetailVo.getSingleDosage());
        info.put("dosage_unit", medicalOutpatientFeeDetailVo.getDosageUnit());
        info.put("daily_frequency", medicalOutpatientFeeDetailVo.getDailyFrequency());
        info.put("medication_days", medicalOutpatientFeeDetailVo.getMedicationDays());
        info.put("single_compund_flag", medicalOutpatientFeeDetailVo.getSingleCompundFlag());
        info.put("herbal_medicine_amount", medicalOutpatientFeeDetailVo.getHerbalMedicineAmount());
        info.put("item_price_limit", medicalOutpatientFeeDetailVo.getItemPriceLimit());
        info.put("approval_no", medicalOutpatientFeeDetailVo.getApprovalNo());
        info.put("self_expense_flag", medicalOutpatientFeeDetailVo.getSelfExpenseFlag());
        info.put("special_medication_flag", medicalOutpatientFeeDetailVo.getSpecialMedicationFlag());
        info.put("commercial_insure_info", medicalOutpatientFeeDetailVo.getCommercialInsureInfo());
        info.put("single_quantity", medicalOutpatientFeeDetailVo.getSingleQuantity());
        info.put("frequency_amount", medicalOutpatientFeeDetailVo.getFrequencyAmount());
        info.put("supply_type", medicalOutpatientFeeDetailVo.getSupplyType());
        info.put("frequency_code", medicalOutpatientFeeDetailVo.getFrequencyCode());
        info.put("item_unit_code", medicalOutpatientFeeDetailVo.getItemUnitCode());
        info.put("drug_serial_no", medicalOutpatientFeeDetailVo.getDrugSerialNo());
        info.put("drug_produce_origin", medicalOutpatientFeeDetailVo.getDrugProduceOrigin());
        info.put("drug_quantity", medicalOutpatientFeeDetailVo.getDrugQuantity());
        info.put("item_accur_date", medicalOutpatientFeeDetailVo.getItemAccurDate());
        info.put("doctor_no", medicalOutpatientFeeDetailVo.getDoctorNo());
        info.put("doctor_name", medicalOutpatientFeeDetailVo.getDoctorName());
        info.put("composition", medicalOutpatientFeeDetailVo.getComposition());
        info.put("indication", medicalOutpatientFeeDetailVo.getIndication());
        info.put("taboo", medicalOutpatientFeeDetailVo.getTaboo());
        info.put("prescription_flag", medicalOutpatientFeeDetailVo.getPrescriptionFlag());
        info.put("medical_restriction_flag", medicalOutpatientFeeDetailVo.getMedicalRestrictionFlag());
        info.put("medical_restriction", medicalOutpatientFeeDetailVo.getMedicalRestriction());
        info.put("base_medicine_flag", medicalOutpatientFeeDetailVo.getBaseMedicineFlag());
        info.put("nation_drug_no", medicalOutpatientFeeDetailVo.getNationDrugNo());
        info.put("registration_no", medicalOutpatientFeeDetailVo.getRegistrationNo());
        info.put("brand", medicalOutpatientFeeDetailVo.getBrand());
        info.put("item_en_name", medicalOutpatientFeeDetailVo.getItemEnName());
        info.put("medical_security", medicalOutpatientFeeDetailVo.getMedicalSecurity());
        info.put("price_ceiling1", conveterIntToDouble(medicalOutpatientFeeDetailVo.getPriceCeiling1()));
        info.put("price_ceiling2", conveterIntToDouble(medicalOutpatientFeeDetailVo.getPriceCeiling2()));
        info.put("price_ceiling3", conveterIntToDouble(medicalOutpatientFeeDetailVo.getPriceCeiling3()));
        info.put("price_ceiling4", conveterIntToDouble(medicalOutpatientFeeDetailVo.getPriceCeiling4()));
        info.put("ins_settle_amount", medicalOutpatientFeeDetailVo.getInsSettleAmount());
        info.put("manufacturer", medicalOutpatientFeeDetailVo.getManufacturer());
        info.put("case_no", medicalOutpatientFeeDetailVo.getCaseNo());
        info.put("expense_category", medicalOutpatientFeeDetailVo.getExpenseCategory());

        info.put("rows", medicalOutpatientFeeDetailVo.getTotalRows());
        info.put("offset", medicalOutpatientFeeDetailVo.getCurrentOffset());
        String beforeEncryptData = sceneData.toJSONString();
        logger.info("mzFeeId={},门诊费用明细加密前数据beforeEncryptData={}",medicalOutpatientFeeDetailVo.getOutpatientSerialNo(), beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }


    public static String encryptMedicalInhospitalFeeVo(MedicalInhospitalFeeVo medicalInhospitalFeeVo, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);

        info.put("inhospital_serial_no", medicalInhospitalFeeVo.getInhospitalSerialNo());
        info.put("refund_serial_no", medicalInhospitalFeeVo.getRefundSerialNo());
        info.put("social_security_no", medicalInhospitalFeeVo.getSocialSecurityNo());
        info.put("ins_type", medicalInhospitalFeeVo.getInsType());
        info.put("invoice_no", medicalInhospitalFeeVo.getInvoiceNo());
        info.put("directory_category", medicalInhospitalFeeVo.getDirectoryCategory());
        info.put("total_invoice", conveterIntToDouble(medicalInhospitalFeeVo.getTotalInvoice()));
        info.put("total_self_expense", conveterIntToDouble(medicalInhospitalFeeVo.getTotalSelfExpense()));
        info.put("total_self_care_expense", conveterIntToDouble(medicalInhospitalFeeVo.getTotalSelfCareExpense()));
        info.put("overall_payment_expense", conveterIntToDouble(medicalInhospitalFeeVo.getOverallPaymentExpense()));
        info.put("large_payment_expense", conveterIntToDouble(medicalInhospitalFeeVo.getLargePaymentExpense()));
        info.put("overall_fund_expenditure", conveterIntToDouble(medicalInhospitalFeeVo.getOverallFundExpenditure()));
        info.put("case_no", medicalInhospitalFeeVo.getCaseNo());
        info.put("pay_no", medicalInhospitalFeeVo.getPayNo());
        info.put("rows", medicalInhospitalFeeVo.getTotalRows());
        info.put("offset", medicalInhospitalFeeVo.getCurrentOffset());


        info.put("medical_expense_settlement_mode_name", medicalInhospitalFeeVo.getMedicalExpenseSettlementModeName());
        info.put("medical_expense_settlement_mode_no", medicalInhospitalFeeVo.getMedicalExpenseSettlementModeNo());
        info.put("previous_account_payment", conveterIntToDouble(medicalInhospitalFeeVo.getPreviousAccountPayment()));
        info.put("current_account_payment", conveterIntToDouble(medicalInhospitalFeeVo.getCurrentAccountPayment()));
        info.put("civil_subsidy_payment", conveterIntToDouble(medicalInhospitalFeeVo.getCivilSubsidyPayment()));
        info.put("personal_conceit", conveterIntToDouble(medicalInhospitalFeeVo.getPersonalConceit()));
        info.put("personal_cash_payment", conveterIntToDouble(medicalInhospitalFeeVo.getPersonalCashPayment()));
        info.put("current_account_balance", conveterIntToDouble(medicalInhospitalFeeVo.getCurrentAccountBalance()));
        info.put("previous_account_balance", conveterIntToDouble(medicalInhospitalFeeVo.getPreviousAccountBalance()));
        info.put("serious_illness_compliance_expense", conveterIntToDouble(medicalInhospitalFeeVo.getSeriousIllnessComplianceExpense()));
        info.put("difficult_relief_fund_payment", conveterIntToDouble(medicalInhospitalFeeVo.getDifficultReliefFundPayment()));
        info.put("model_worker_fund_payment", conveterIntToDouble(medicalInhospitalFeeVo.getModelWorkerFundPayment()));
        info.put("health_fund_payment", conveterIntToDouble(medicalInhospitalFeeVo.getHealthFundPayment()));
        info.put("prompt_message", medicalInhospitalFeeVo.getPromptMessage());
        info.put("old_worker_fund_payment", conveterIntToDouble(medicalInhospitalFeeVo.getOldWorkerFundPayment()));
        info.put("hospital_commitment", conveterIntToDouble(medicalInhospitalFeeVo.getHospitalCommitment()));
        info.put("other_fund_payment", conveterIntToDouble(medicalInhospitalFeeVo.getOtherFundPayment()));
        info.put("collection_date", medicalInhospitalFeeVo.getCollectionDate());
        info.put("collection_unit", medicalInhospitalFeeVo.getCollectionUnit());
        info.put("toller", medicalInhospitalFeeVo.getToller());
        info.put("hospital_no", medicalInhospitalFeeVo.getHospitalNo());
        info.put("pay_line", conveterIntToDouble(medicalInhospitalFeeVo.getPayLine()));
        info.put("prepay_amount", conveterIntToDouble(medicalInhospitalFeeVo.getPrepayAmount()));
        info.put("backpay_amount", conveterIntToDouble(medicalInhospitalFeeVo.getBackpayAmount()));
        info.put("refund_amount", conveterIntToDouble(medicalInhospitalFeeVo.getRefund_amount()));
        info.put("medical_ins_limit", conveterIntToDouble(medicalInhospitalFeeVo.getMedicalInsLimit()));

        String beforeEncryptData = sceneData.toJSONString();
        logger.info("inpatientId={},住院费用信息加密前数据beforeEncryptData={}", medicalInhospitalFeeVo.getInhospitalSerialNo(),beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }

    public static String encryptMedicalInhospitalFeeDetailVo(MedicalInhospitalFeeDetailVo medicalInhospitalFeeDetailVo, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);

        info.put("document_no", medicalInhospitalFeeDetailVo.getDocumentNo());
        info.put("inhospital_serial_no", medicalInhospitalFeeDetailVo.getInhospitalSerialNo());
        info.put("pay_no", medicalInhospitalFeeDetailVo.getPayNo());
        info.put("expense_detail_item_name", medicalInhospitalFeeDetailVo.getExpenseDetailItemName());
        info.put("expense_detail_item_no", medicalInhospitalFeeDetailVo.getExpenseDetailItemNo());
        info.put("expense_detail_unit", medicalInhospitalFeeDetailVo.getExpenseDetailUnit());
        info.put("expense_detail_spec", medicalInhospitalFeeDetailVo.getExpenseDetailSpec());
        info.put("expense_detail_univalent",conveterIntToDouble(medicalInhospitalFeeDetailVo.getExpenseDetailUnivalent()));
        info.put("expense_category", medicalInhospitalFeeDetailVo.getExpenseCategory());

        info.put("expense_detail_quantity", medicalInhospitalFeeDetailVo.getExpenseDetailQuantity());
        info.put("expense_detail_amount", conveterIntToDouble(medicalInhospitalFeeDetailVo.getExpenseDetailAmount()));
        info.put("total_expense", conveterIntToDouble(medicalInhospitalFeeDetailVo.getTotalExpense()));
        info.put("case_no", medicalInhospitalFeeDetailVo.getCaseNo());


        info.put("expense_detail_spec", medicalInhospitalFeeDetailVo.getExpenseDetailSpec());
        info.put("self_payment_ratio", medicalInhospitalFeeDetailVo.getSelfPaymentRatio());
        info.put("item_spec", medicalInhospitalFeeDetailVo.getItemSpec());
        info.put("item_dosage_form", medicalInhospitalFeeDetailVo.getItemDosageForm());
        info.put("item_unit", medicalInhospitalFeeDetailVo.getItemUnit());
        info.put("item_origin_name", medicalInhospitalFeeDetailVo.getItemOriginName());
        info.put("package_quantity", medicalInhospitalFeeDetailVo.getPackageQuantity());
        info.put("package_unit", medicalInhospitalFeeDetailVo.getPackageUnit());
        info.put("min_dosage_unit", medicalInhospitalFeeDetailVo.getMinDosageUnit());
        info.put("single_dosage", medicalInhospitalFeeDetailVo.getSingleDosage());
        info.put("dosage_unit", medicalInhospitalFeeDetailVo.getDosageUnit());
        info.put("daily_frequency", medicalInhospitalFeeDetailVo.getDailyFrequency());
        info.put("medication_days", medicalInhospitalFeeDetailVo.getMedicationDays());
        info.put("single_compund_flag", medicalInhospitalFeeDetailVo.getSingleCompundFlag());
        info.put("herbal_medicine_amount", medicalInhospitalFeeDetailVo.getHerbalMedicineAmount());
        info.put("item_price_limit", conveterIntToDouble(medicalInhospitalFeeDetailVo.getItemPriceLimit()));
        info.put("approval_no", medicalInhospitalFeeDetailVo.getApprovalNo());
        info.put("self_expense_flag", medicalInhospitalFeeDetailVo.getSelfExpenseFlag());
        info.put("special_medication_flag", medicalInhospitalFeeDetailVo.getSpecialMedicationFlag());
        info.put("commercial_insure_info", medicalInhospitalFeeDetailVo.getCommercialInsureInfo());
        info.put("single_quantity", medicalInhospitalFeeDetailVo.getSingleQuantity());
        info.put("frequency_amount", medicalInhospitalFeeDetailVo.getFrequencyAmount());
        info.put("supply_type", medicalInhospitalFeeDetailVo.getSupplyType());
        info.put("frequency_no", medicalInhospitalFeeDetailVo.getFrequencyNo());
        info.put("item_unit_no", medicalInhospitalFeeDetailVo.getItemUnitCode());
        info.put("drug_serial_no", medicalInhospitalFeeDetailVo.getDrugSerialNo());
        info.put("drug_produce_origin", medicalInhospitalFeeDetailVo.getDrugProduceOrigin());
        info.put("drug_quantity", medicalInhospitalFeeDetailVo.getDrugQuantity());
        info.put("item_accur_date", medicalInhospitalFeeDetailVo.getItemAccurDate());
        info.put("doctor_no", medicalInhospitalFeeDetailVo.getDoctorNo());
        info.put("doctor_name", medicalInhospitalFeeDetailVo.getDoctorName());
        info.put("composition", medicalInhospitalFeeDetailVo.getComposition());
        info.put("indication", medicalInhospitalFeeDetailVo.getIndication());
        info.put("taboo", medicalInhospitalFeeDetailVo.getTaboo());
        info.put("prescription_flag", medicalInhospitalFeeDetailVo.getPrescriptionFlag());
        info.put("medical_restriction_flag", medicalInhospitalFeeDetailVo.getMedicalRestrictionFlag());
        info.put("medical_restriction", medicalInhospitalFeeDetailVo.getMedicalRestriction());
        info.put("base_medicine_flag", medicalInhospitalFeeDetailVo.getBaseMedicineFlag());
        info.put("nation_drug_no", medicalInhospitalFeeDetailVo.getNationDrugNo());
        info.put("registration_no", medicalInhospitalFeeDetailVo.getRegistrationNo());
        info.put("brand", medicalInhospitalFeeDetailVo.getBrand());
        info.put("item_en_name", medicalInhospitalFeeDetailVo.getItemEnName());
        info.put("medical_security", medicalInhospitalFeeDetailVo.getMedicalSecurity());
        info.put("price_ceiling1", conveterIntToDouble(medicalInhospitalFeeDetailVo.getPriceCeiling1()));
        info.put("price_ceiling2", conveterIntToDouble(medicalInhospitalFeeDetailVo.getPriceCeiling2()));
        info.put("price_ceiling3", conveterIntToDouble(medicalInhospitalFeeDetailVo.getPriceCeiling3()));
        info.put("price_ceiling4", conveterIntToDouble(medicalInhospitalFeeDetailVo.getPriceCeiling4()));
        info.put("ins_settle_amount", medicalInhospitalFeeDetailVo.getInsSettleAmount());
        info.put("manufacturer", medicalInhospitalFeeDetailVo.getManufacturer());

        info.put("rows", medicalInhospitalFeeDetailVo.getTotalRows());
        info.put("offset", medicalInhospitalFeeDetailVo.getCurrentOffset());

        String beforeEncryptData = sceneData.toJSONString();
        logger.info("inpatientId={},住院费用明细加密前数据beforeEncryptData={}",  medicalInhospitalFeeDetailVo.getInhospitalSerialNo(),beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }


    public static String encryptMedicalChecking(MedicalOutpatientCheckingVo medicalOutpatientCheckingVo, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);

        info.put("outpatient_serial_no", medicalOutpatientCheckingVo.getOutpatientSerialNo());
        info.put("check_record_id", medicalOutpatientCheckingVo.getCheckRecordId());
        info.put("case_no", medicalOutpatientCheckingVo.getCaseNo());
        info.put("patient_id", medicalOutpatientCheckingVo.getPatientId());

        info.put("inspect_hospital_no", medicalOutpatientCheckingVo.getInspectHospitalNo());
        info.put("inspect_hospital_name", medicalOutpatientCheckingVo.getInspectHospitalName());
        info.put("check_date", medicalOutpatientCheckingVo.getCheckDate());
        info.put("inspect_dept_name", medicalOutpatientCheckingVo.getInspectDeptName());
        info.put("inspect_dept_no", medicalOutpatientCheckingVo.getInspectDeptNo());
        info.put("inspect_doctor_name", medicalOutpatientCheckingVo.getInspectDoctorName());
        info.put("inspect_doctor_no", medicalOutpatientCheckingVo.getInspectDoctorNo());
        info.put("check_category_no", medicalOutpatientCheckingVo.getCheckCategoryNo());
        info.put("check_dept_name", medicalOutpatientCheckingVo.getCheckDeptName());

        info.put("check_dept_no", medicalOutpatientCheckingVo.getCheckDeptNo());
        info.put("executive_doctor_name", medicalOutpatientCheckingVo.getExecutiveDoctorName());
        info.put("executive_doctor_no", medicalOutpatientCheckingVo.getExecutiveDoctorNo());
        info.put("audit_doctor_name", medicalOutpatientCheckingVo.getAuditDoctorName());
        info.put("audit_doctor_no", medicalOutpatientCheckingVo.getAuditDoctorNo());
        info.put("patient_type", medicalOutpatientCheckingVo.getPatientType());
        info.put("result_desc", medicalOutpatientCheckingVo.getResultDesc());
        info.put("rows", medicalOutpatientCheckingVo.getTotalRows());
        info.put("offset", medicalOutpatientCheckingVo.getCurrentOffset());
        String beforeEncryptData = sceneData.toJSONString();
        logger.info("mzFeeId={},门诊检验信息加密前数据beforeEncryptData =={}", medicalOutpatientCheckingVo.getOutpatientSerialNo(),beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }

    public static String encryptMedicalCheckingDetialVo(MedicalOutpatientCheckingDetailVo medicalOutpatientCheckingDetailVo, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);

        info.put("check_item_name", medicalOutpatientCheckingDetailVo.getCheckItemName());
        info.put("check_result", medicalOutpatientCheckingDetailVo.getCheckResult());
        info.put("check_record_id", medicalOutpatientCheckingDetailVo.getCheckRecordId());
        info.put("outpatient_serial_no", medicalOutpatientCheckingDetailVo.getOutpatientSerialNo());
        info.put("check_serial_no", medicalOutpatientCheckingDetailVo.getCheckSerialNo());
        info.put("report_doctor_name", medicalOutpatientCheckingDetailVo.getReportDoctorName());
        info.put("report_date", medicalOutpatientCheckingDetailVo.getReportDate());
        info.put("check_result_value", medicalOutpatientCheckingDetailVo.getCheckResultValue());
        info.put("check_measure_unit", medicalOutpatientCheckingDetailVo.getCheckMeasureUnit());
        info.put("reference_range", medicalOutpatientCheckingDetailVo.getReferenceRange());

        info.put("check_item_no", medicalOutpatientCheckingDetailVo.getCheckItemNo());
        info.put("check_way", medicalOutpatientCheckingDetailVo.getCheckWay());
        info.put("check_instruction", medicalOutpatientCheckingDetailVo.getCheckInstruction());
        info.put("specimen_type", medicalOutpatientCheckingDetailVo.getSpecimenType());
        info.put("specimen_collect_site", medicalOutpatientCheckingDetailVo.getSpecimenCollectSite());
        info.put("audit_date", medicalOutpatientCheckingDetailVo.getAuditDate());
        info.put("report_doctor_no", medicalOutpatientCheckingDetailVo.getReportDoctorNo());
        info.put("check_result_no", medicalOutpatientCheckingDetailVo.getCheckResultNo());

        info.put("case_no", medicalOutpatientCheckingDetailVo.getCaseNo());
        info.put("rows", medicalOutpatientCheckingDetailVo.getTotalRows());
        info.put("offset", medicalOutpatientCheckingDetailVo.getCurrentOffset());
        String beforeEncryptData = sceneData.toJSONString();
        logger.info("mzFeeId={},门诊检验明细加密前数据beforeEncryptData={}",medicalOutpatientCheckingDetailVo.getOutpatientSerialNo(), beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }

    public static String encryptMedicalOutpatientExaminationVo(MedicalOutpatientExaminationVo medicalOutpatientExaminationVo, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);

        info.put("outpatient_serial_no", medicalOutpatientExaminationVo.getOutpatientSerialNo());
        info.put("exam_record_id", medicalOutpatientExaminationVo.getExamRecordId());
        info.put("case_no", medicalOutpatientExaminationVo.getCaseNo());
        info.put("patient_id", medicalOutpatientExaminationVo.getPatientId());
        info.put("audit_date", medicalOutpatientExaminationVo.getAuditDate());
        info.put("exam_date", medicalOutpatientExaminationVo.getExamDate());
        info.put("exam_item_ch_name", medicalOutpatientExaminationVo.getExamItemChName());
        info.put("img_desc", medicalOutpatientExaminationVo.getImgDesc());
        info.put("img_diagnosis", medicalOutpatientExaminationVo.getImgDiagnosis());

        info.put("inspect_dept_name", medicalOutpatientExaminationVo.getInspectDeptName());
        info.put("inspect_doctor_name", medicalOutpatientExaminationVo.getInspectDoctorName());
        info.put("inspect_doctor_no", medicalOutpatientExaminationVo.getInspectDoctorNo());
        info.put("emergency_exam_flag", medicalOutpatientExaminationVo.getEmergencyExamFlag());
        info.put("exam_dept_name", medicalOutpatientExaminationVo.getExamDeptName());
        info.put("exam_dept_no", medicalOutpatientExaminationVo.getExamDeptNo());
        info.put("executive_doctor_name", medicalOutpatientExaminationVo.getExecutiveDoctorName());
        info.put("executive_doctor_no", medicalOutpatientExaminationVo.getExecutiveDoctorNo());
        info.put("audit_doctor_name", medicalOutpatientExaminationVo.getAuditDoctorName());
        info.put("audit_doctor_no", medicalOutpatientExaminationVo.getAuditDoctorNo());
        info.put("exam_type", medicalOutpatientExaminationVo.getExamType());
        info.put("exam_way", medicalOutpatientExaminationVo.getExamWay());
        info.put("exam_instruction", medicalOutpatientExaminationVo.getExamInstruction());
        info.put("exam_item_no", medicalOutpatientExaminationVo.getExamItemNo());
        info.put("exam_item_en_name", medicalOutpatientExaminationVo.getExamItemEnName());
        info.put("exam_result_no", medicalOutpatientExaminationVo.getExamResultNo());
        info.put("result_desc", medicalOutpatientExaminationVo.getResultDesc());
        info.put("report_doctor_name", medicalOutpatientExaminationVo.getReportDoctorName());
        info.put("report_doctor_no", medicalOutpatientExaminationVo.getReportDoctorNo());
        info.put("report_date", medicalOutpatientExaminationVo.getReportDate());
        info.put("ris_relative_no", medicalOutpatientExaminationVo.getRisRelativeNo());
        info.put("img_global_signal", medicalOutpatientExaminationVo.getImgGlobalSignal());
        info.put("patient_type", medicalOutpatientExaminationVo.getPatientType());
        info.put("exam_equip_type", medicalOutpatientExaminationVo.getExamEquipType());
        info.put("clinical_diagnosis", medicalOutpatientExaminationVo.getClinicalDiagnosis());
        info.put("exam_site_no", medicalOutpatientExaminationVo.getExamSiteNo());
        info.put("exam_site", medicalOutpatientExaminationVo.getExamSite());
        info.put("img_no", medicalOutpatientExaminationVo.getImgNo());

        info.put("rows", medicalOutpatientExaminationVo.getTotalRows());
        info.put("offset", medicalOutpatientExaminationVo.getCurrentOffset());
        String beforeEncryptData = sceneData.toJSONString();
        logger.info("mzFeeId={},门诊检查信息加密前数据beforeEncryptData={}",  medicalOutpatientExaminationVo.getOutpatientSerialNo(),beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }


    public static String encryptMedicalOutpatientOperationRecordVo(MedicalOutpatientOperationRecordVo medicalOutpatientOperationRecordVo, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);

        info.put("outpatient_serial_no", medicalOutpatientOperationRecordVo.getOutpatientSerialNo());
        info.put("patient_id", medicalOutpatientOperationRecordVo.getPatientId());
        info.put("operation_id", medicalOutpatientOperationRecordVo.getOperationId());
        info.put("operation_date", medicalOutpatientOperationRecordVo.getOperationDate());
        info.put("operation_no", medicalOutpatientOperationRecordVo.getOperationNo());
        info.put("operation_name", medicalOutpatientOperationRecordVo.getOperationName());

        info.put("preoperative_diagnosis", medicalOutpatientOperationRecordVo.getPreoperativeDiagnosis());
        info.put("intraoperative_diagnosis", medicalOutpatientOperationRecordVo.getIntraoperativeDiagnosis());
        info.put("operative", medicalOutpatientOperationRecordVo.getOperative());
        info.put("assistant_name", medicalOutpatientOperationRecordVo.getAssistantName());
        info.put("anesthesia_way", medicalOutpatientOperationRecordVo.getAnesthesiaWay());
        info.put("intraoperation_treat", medicalOutpatientOperationRecordVo.getIntraoperationTreat());
        info.put("surgical_procedure", medicalOutpatientOperationRecordVo.getSurgicalProcedure());
        info.put("electronic_medical_records", medicalOutpatientOperationRecordVo.getElectronicMedicalRecords());
        info.put("item_spec", medicalOutpatientOperationRecordVo.getItemSpec());
        info.put("item_dosage_form", medicalOutpatientOperationRecordVo.getItemDosageForm());
        info.put("item_unit", medicalOutpatientOperationRecordVo.getItemUnit());
        info.put("item_origin_name", medicalOutpatientOperationRecordVo.getItemOriginName());
        info.put("package_quantity", medicalOutpatientOperationRecordVo.getPackageQuantity());
        info.put("package_unit", medicalOutpatientOperationRecordVo.getPackageUnit());
        info.put("min_dosage_unit", medicalOutpatientOperationRecordVo.getMinDosageUnit());
        info.put("single_dosage", medicalOutpatientOperationRecordVo.getSingleDosage());
        info.put("dosage_unit", medicalOutpatientOperationRecordVo.getDosageUnit());
        info.put("daily_frequency", medicalOutpatientOperationRecordVo.getDailyFrequency());
        info.put("medication_days", medicalOutpatientOperationRecordVo.getMedicationDays());
        info.put("single_compund_flag", medicalOutpatientOperationRecordVo.getSingleCompundFlag());
        info.put("herbal_medicine_amount", medicalOutpatientOperationRecordVo.getHerbalMedicineAmount());
        info.put("item_price_limit", medicalOutpatientOperationRecordVo.getItemPriceLimit());
        info.put("approval_no", medicalOutpatientOperationRecordVo.getApprovalNo());
        info.put("self_expense_flag", medicalOutpatientOperationRecordVo.getSelfExpenseFlag());
        info.put("special_medication_flag", medicalOutpatientOperationRecordVo.getSpecialMedicationFlag());
        info.put("commercial_insure_info", medicalOutpatientOperationRecordVo.getCommercialInsureInfo());
        info.put("single_quantity", medicalOutpatientOperationRecordVo.getSingleQuantity());
        info.put("frequency_amount", medicalOutpatientOperationRecordVo.getFrequencyAmount());
        info.put("supply_type", medicalOutpatientOperationRecordVo.getSupplyType());
        info.put("frequency_code", medicalOutpatientOperationRecordVo.getFrequencyCode());
        info.put("item_unit_code", medicalOutpatientOperationRecordVo.getItemUnitCode());
        info.put("drug_serial_no", medicalOutpatientOperationRecordVo.getDrugSerialNo());


        info.put("drug_produce_origin", medicalOutpatientOperationRecordVo.getDrugProduceOrigin());
        info.put("drug_quantity", medicalOutpatientOperationRecordVo.getDrugQuantity());
        info.put("item_accur_date", medicalOutpatientOperationRecordVo.getItemAccurDate());
        info.put("doctor_no", medicalOutpatientOperationRecordVo.getDoctorNo());
        info.put("doctor_name", medicalOutpatientOperationRecordVo.getDoctorName());
        info.put("composition", medicalOutpatientOperationRecordVo.getComposition());
        info.put("indication", medicalOutpatientOperationRecordVo.getIndication());
        info.put("taboo", medicalOutpatientOperationRecordVo.getTaboo());
        info.put("prescription_flag", medicalOutpatientOperationRecordVo.getPrescriptionFlag());
        info.put("medical_restriction_flag", medicalOutpatientOperationRecordVo.getMedicalRestrictionFlag());
        info.put("medical_restriction", medicalOutpatientOperationRecordVo.getMedicalRestriction());
        info.put("base_medicine_flag", medicalOutpatientOperationRecordVo.getBaseMedicineFlag());
        info.put("nation_drug_no", medicalOutpatientOperationRecordVo.getNationDrugNo());
        info.put("registration_no", medicalOutpatientOperationRecordVo.getRegistrationNo());
        info.put("brand", medicalOutpatientOperationRecordVo.getBrand());
        info.put("item_en_name", medicalOutpatientOperationRecordVo.getItemEnName());
        info.put("medical_security", medicalOutpatientOperationRecordVo.getMedicalSecurity());
        info.put("price_ceiling1", conveterIntToDouble(medicalOutpatientOperationRecordVo.getPriceCeiling1()));
        info.put("price_ceiling2", conveterIntToDouble(medicalOutpatientOperationRecordVo.getPriceCeiling2()));
        info.put("price_ceiling3", conveterIntToDouble(medicalOutpatientOperationRecordVo.getPriceCeiling3()));
        info.put("price_ceiling4", conveterIntToDouble(medicalOutpatientOperationRecordVo.getPriceCeiling4()));
        info.put("ins_settle_amount", medicalOutpatientOperationRecordVo.getInsSettleAmount());

        info.put("case_no", medicalOutpatientOperationRecordVo.getCaseNo());
        info.put("rows", medicalOutpatientOperationRecordVo.getTotalRows());
        info.put("offset", medicalOutpatientOperationRecordVo.getCurrentOffset());
        String beforeEncryptData = sceneData.toJSONString();
        logger.info("门诊手术记录信息加密前数据beforeEncryptData={}", beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }

    public static String encryptMedicalInhospitalCheckingVo(MedicalInhospitalCheckingVo medicalInhospitalCheckingVo, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);

        info.put("inhospital_serial_no", medicalInhospitalCheckingVo.getInhospitalSerialNo());
        info.put("inhospital_no", medicalInhospitalCheckingVo.getInhospitalNo());
        info.put("check_record_id", medicalInhospitalCheckingVo.getCheckRecordId());
        info.put("case_no", medicalInhospitalCheckingVo.getCaseNo());
        info.put("patient_id", medicalInhospitalCheckingVo.getPatientId());
        info.put("check_category_no", medicalInhospitalCheckingVo.getCheckCategoryNo());
        info.put("check_dept_name", medicalInhospitalCheckingVo.getCheckDeptName());
        info.put("result_desc", medicalInhospitalCheckingVo.getResultDesc());

        info.put("inspect_hospital_no", medicalInhospitalCheckingVo.getInspectHospitalNo());
        info.put("inspect_hospital_name", medicalInhospitalCheckingVo.getInspectHospitalName());
        info.put("check_date", medicalInhospitalCheckingVo.getCheckDate());
        info.put("inspect_dept_name", medicalInhospitalCheckingVo.getInspectDeptName());
        info.put("inspect_dept_no", medicalInhospitalCheckingVo.getInspectDeptNo());
        info.put("inspect_doctor_name", medicalInhospitalCheckingVo.getInspectDoctorName());
        info.put("inspect_doctor_no", medicalInhospitalCheckingVo.getInspectDoctorNo());
        info.put("check_dept_no", medicalInhospitalCheckingVo.getCheckDeptNo());
        info.put("executive_doctor_name", medicalInhospitalCheckingVo.getExecutiveDoctorName());
        info.put("executive_doctor_no", medicalInhospitalCheckingVo.getExecutiveDoctorNo());
        info.put("audit_doctor_name", medicalInhospitalCheckingVo.getAuditDoctorName());
        info.put("audit_doctor_no", medicalInhospitalCheckingVo.getAuditDoctorNo());
        info.put("patient_type", medicalInhospitalCheckingVo.getPatientType());

        info.put("rows", medicalInhospitalCheckingVo.getTotalRows());
        info.put("offset", medicalInhospitalCheckingVo.getCurrentOffset());
        String beforeEncryptData = sceneData.toJSONString();
        logger.info("inPatientId={},住院检验信息加密前数据beforeEncryptData={}",medicalInhospitalCheckingVo.getInhospitalSerialNo(), beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }



    public static String encryptMedicalInhospitalCheckingDetailVo(MedicalInhospitalCheckingDetailVo medicalInhospitalCheckingDetailVo, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);

        info.put("check_item_name", medicalInhospitalCheckingDetailVo.getCheckItemName());
        info.put("check_result", medicalInhospitalCheckingDetailVo.getCheckResult());
        info.put("check_record_id", medicalInhospitalCheckingDetailVo.getCheckRecordId());
        info.put("inhospital_serial_no", medicalInhospitalCheckingDetailVo.getInhospitalSerialNo());
        info.put("check_serial_no", medicalInhospitalCheckingDetailVo.getCheckSerialNo());
        info.put("report_doctor_name", medicalInhospitalCheckingDetailVo.getReportDoctorName());
        info.put("report_date", medicalInhospitalCheckingDetailVo.getReportDate());
        info.put("check_result_value", medicalInhospitalCheckingDetailVo.getCheckResultValue());
        info.put("check_measure_unit", medicalInhospitalCheckingDetailVo.getCheckMeasureUnit());
        info.put("reference_range", medicalInhospitalCheckingDetailVo.getReferenceRange());


        info.put("check_item_no", medicalInhospitalCheckingDetailVo.getCheckItemNo());
        info.put("check_way", medicalInhospitalCheckingDetailVo.getCheckWay());
        info.put("check_instruction", medicalInhospitalCheckingDetailVo.getCheckInstruction());
        info.put("specimen_type", medicalInhospitalCheckingDetailVo.getSpecimenType());
        info.put("specimen_collect_site", medicalInhospitalCheckingDetailVo.getSpecimenCollectSite());
        info.put("audit_date", medicalInhospitalCheckingDetailVo.getAuditDate());
        info.put("report_doctor_no", medicalInhospitalCheckingDetailVo.getReportDoctorNo());
        info.put("check_result_no", medicalInhospitalCheckingDetailVo.getCheckResultNo());

        info.put("case_no", medicalInhospitalCheckingDetailVo.getCaseNo());
        info.put("rows", medicalInhospitalCheckingDetailVo.getTotalRows());
        info.put("offset", medicalInhospitalCheckingDetailVo.getCurrentOffset());
        String beforeEncryptData = sceneData.toJSONString();
        logger.info("inPatientId={},住院检验明细加密前数据beforeEncryptData={}",medicalInhospitalCheckingDetailVo.getInhospitalSerialNo(), beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }


    public static String encryptMedicalInhospitalExaminationVo(MedicalInhospitalExaminationVo medicalInhospitalExaminationVo, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);

        info.put("inhospital_serial_no", medicalInhospitalExaminationVo.getInhospitalSerialNo());
        info.put("inhospital_no", medicalInhospitalExaminationVo.getInhospitalNo());
        info.put("exam_record_id", medicalInhospitalExaminationVo.getExamRecordId());
        info.put("case_no", medicalInhospitalExaminationVo.getCaseNo());
        info.put("patient_id", medicalInhospitalExaminationVo.getPatientId());
        info.put("audit_date", medicalInhospitalExaminationVo.getAuditDate());
        info.put("exam_date", medicalInhospitalExaminationVo.getExamDate());
        info.put("exam_item_ch_name", medicalInhospitalExaminationVo.getExamItemChName());
        info.put("img_desc", medicalInhospitalExaminationVo.getImgDesc());
        info.put("img_diagnosis", medicalInhospitalExaminationVo.getImgDiagnosis());

        info.put("inspect_dept_name", medicalInhospitalExaminationVo.getInspectDeptName());
        info.put("inspect_doctor_name", medicalInhospitalExaminationVo.getInspectDoctorName());
        info.put("inspect_doctor_no", medicalInhospitalExaminationVo.getInspectDoctorNo());
        info.put("emergency_exam_flag", medicalInhospitalExaminationVo.getEmergencyExamFlag());
        info.put("exam_dept_name", medicalInhospitalExaminationVo.getExamDeptName());
        info.put("exam_dept_no", medicalInhospitalExaminationVo.getExamDeptNo());
        info.put("executive_doctor_name", medicalInhospitalExaminationVo.getExecutiveDoctorName());
        info.put("executive_doctor_no", medicalInhospitalExaminationVo.getExecutiveDoctorNo());
        info.put("audit_doctor_name", medicalInhospitalExaminationVo.getAuditDoctorName());
        info.put("audit_doctor_no", medicalInhospitalExaminationVo.getAuditDoctorNo());
        info.put("exam_type", medicalInhospitalExaminationVo.getExamType());
        info.put("exam_way", medicalInhospitalExaminationVo.getExamWay());
        info.put("exam_instruction", medicalInhospitalExaminationVo.getExamInstruction());
        info.put("exam_item_no", medicalInhospitalExaminationVo.getExamItemNo());
        info.put("exam_item_en_name", medicalInhospitalExaminationVo.getExamItemEnName());
        info.put("exam_result_no", medicalInhospitalExaminationVo.getExamResultNo());
        info.put("result_desc", medicalInhospitalExaminationVo.getResultDesc());
        info.put("report_doctor_name", medicalInhospitalExaminationVo.getReportDoctorName());
        info.put("report_doctor_no", medicalInhospitalExaminationVo.getReportDoctorNo());
        info.put("report_date", medicalInhospitalExaminationVo.getReportDate());
        info.put("ris_relative_no", medicalInhospitalExaminationVo.getRisRelativeNo());
        info.put("img_global_signal", medicalInhospitalExaminationVo.getImgGlobalSignal());
        info.put("patient_type", medicalInhospitalExaminationVo.getPatientType());
        info.put("exam_equip_type", medicalInhospitalExaminationVo.getExamEquipType());
        info.put("clinical_diagnosis", medicalInhospitalExaminationVo.getClinicalDiagnosis());
        info.put("exam_site_no", medicalInhospitalExaminationVo.getExamSiteNo());
        info.put("exam_site", medicalInhospitalExaminationVo.getExamSite());
        info.put("img_no", medicalInhospitalExaminationVo.getImgNo());

        info.put("rows", medicalInhospitalExaminationVo.getTotalRows());
        info.put("offset", medicalInhospitalExaminationVo.getCurrentOffset());
        String beforeEncryptData = sceneData.toJSONString();
        logger.info("inPatientId={},住院检查信息加密前数据beforeEncryptData={}", medicalInhospitalExaminationVo.getInhospitalSerialNo(), beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }

    public static String encryptMedicalInhospitalOperationRecordVo(MedicalInhospitalOperationRecordVo medicalInhospitalOperationRecordVo, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);

        info.put("inhospital_serial_no", medicalInhospitalOperationRecordVo.getInhospitalSerialNo());
        info.put("inhospital_no", medicalInhospitalOperationRecordVo.getInhospitalNo());
        info.put("inhospital_times", medicalInhospitalOperationRecordVo.getInhospitalTimes());

        info.put("patient_id", medicalInhospitalOperationRecordVo.getPatientId());
        info.put("operation_id", medicalInhospitalOperationRecordVo.getOperationId());
        info.put("operation_date", medicalInhospitalOperationRecordVo.getOperationDate());
        info.put("operation_no", medicalInhospitalOperationRecordVo.getOperationNo());
        info.put("operation_name", medicalInhospitalOperationRecordVo.getOperationName());
        info.put("case_no", medicalInhospitalOperationRecordVo.getCaseNo());

        info.put("preoperative_diagnosis", medicalInhospitalOperationRecordVo.getPreoperativeDiagnosis());
        info.put("intraoperative_diagnosis", medicalInhospitalOperationRecordVo.getIntraoperativeDiagnosis());
        info.put("operative", medicalInhospitalOperationRecordVo.getOperative());
        info.put("assistant_name", medicalInhospitalOperationRecordVo.getAssistantName());
        info.put("anesthesia_way", medicalInhospitalOperationRecordVo.getAnesthesiaWay());
        info.put("intraoperation_treat", medicalInhospitalOperationRecordVo.getIntraoperationTreat());
        info.put("surgical_procedure", medicalInhospitalOperationRecordVo.getSurgicalProcedure());
        info.put("electronic_medical_records", medicalInhospitalOperationRecordVo.getElectronicMedicalRecords());
        info.put("item_spec", medicalInhospitalOperationRecordVo.getItemSpec());
        info.put("item_dosage_form", medicalInhospitalOperationRecordVo.getItemDosageForm());
        info.put("item_unit", medicalInhospitalOperationRecordVo.getItemUnit());
        info.put("item_origin_name", medicalInhospitalOperationRecordVo.getItemOriginName());
        info.put("package_quantity", medicalInhospitalOperationRecordVo.getPackageQuantity());
        info.put("package_unit", medicalInhospitalOperationRecordVo.getPackageUnit());
        info.put("min_dosage_unit", medicalInhospitalOperationRecordVo.getMinDosageUnit());
        info.put("single_dosage", medicalInhospitalOperationRecordVo.getSingleDosage());
        info.put("dosage_unit", medicalInhospitalOperationRecordVo.getDosageUnit());
        info.put("daily_frequency", medicalInhospitalOperationRecordVo.getDailyFrequency());
        info.put("medication_days", medicalInhospitalOperationRecordVo.getMedicationDays());
        info.put("single_compund_flag", medicalInhospitalOperationRecordVo.getSingleCompundFlag());
        info.put("herbal_medicine_amount", medicalInhospitalOperationRecordVo.getHerbalMedicineAmount());
        info.put("item_price_limit", medicalInhospitalOperationRecordVo.getItemPriceLimit());
        info.put("approval_no", medicalInhospitalOperationRecordVo.getApprovalNo());
        info.put("self_expense_flag", medicalInhospitalOperationRecordVo.getSelfExpenseFlag());
        info.put("special_medication_flag", medicalInhospitalOperationRecordVo.getSpecialMedicationFlag());
        info.put("commercial_insure_info", medicalInhospitalOperationRecordVo.getCommercialInsureInfo());
        info.put("single_quantity", medicalInhospitalOperationRecordVo.getSingleQuantity());
        info.put("frequency_amount", medicalInhospitalOperationRecordVo.getFrequencyAmount());
        info.put("supply_type", medicalInhospitalOperationRecordVo.getSupplyType());
        info.put("frequency_no", medicalInhospitalOperationRecordVo.getFrequencyCode());
        info.put("item_unit_no", medicalInhospitalOperationRecordVo.getItemUnitCode());
        info.put("drug_serial_no", medicalInhospitalOperationRecordVo.getDrugSerialNo());
        info.put("drug_produce_origin", medicalInhospitalOperationRecordVo.getDrugProduceOrigin());
        info.put("drug_quantity", medicalInhospitalOperationRecordVo.getDrugQuantity());
        info.put("item_accur_date", medicalInhospitalOperationRecordVo.getItemAccurDate());
        info.put("doctor_no", medicalInhospitalOperationRecordVo.getDoctorNo());
        info.put("doctor_name", medicalInhospitalOperationRecordVo.getDoctorName());
        info.put("composition", medicalInhospitalOperationRecordVo.getComposition());
        info.put("indication", medicalInhospitalOperationRecordVo.getIndication());
        info.put("taboo", medicalInhospitalOperationRecordVo.getTaboo());
        info.put("prescription_flag", medicalInhospitalOperationRecordVo.getPrescriptionFlag());
        info.put("medical_restriction_flag", medicalInhospitalOperationRecordVo.getMedicalRestrictionFlag());
        info.put("medical_restriction", medicalInhospitalOperationRecordVo.getMedicalRestriction());
        info.put("base_medicine_flag", medicalInhospitalOperationRecordVo.getBaseMedicineFlag());
        info.put("nation_drug_no", medicalInhospitalOperationRecordVo.getNationDrugNo());
        info.put("registration_no", medicalInhospitalOperationRecordVo.getRegistrationNo());
        info.put("brand", medicalInhospitalOperationRecordVo.getBrand());
        info.put("item_en_name", medicalInhospitalOperationRecordVo.getItemEnName());
        info.put("medical_security", medicalInhospitalOperationRecordVo.getMedicalSecurity());
        info.put("price_ceiling1",conveterIntToDouble(medicalInhospitalOperationRecordVo.getPriceCeiling1()));
        info.put("price_ceiling2", conveterIntToDouble(medicalInhospitalOperationRecordVo.getPriceCeiling2()));
        info.put("price_ceiling3", conveterIntToDouble(medicalInhospitalOperationRecordVo.getPriceCeiling3()));
        info.put("price_ceiling4", conveterIntToDouble(medicalInhospitalOperationRecordVo.getPriceCeiling4()));
        info.put("ins_settle_amount", medicalInhospitalOperationRecordVo.getInsSettleAmount());

        info.put("rows", medicalInhospitalOperationRecordVo.getTotalRows());
        info.put("offset", medicalInhospitalOperationRecordVo.getCurrentOffset());
        String beforeEncryptData = sceneData.toJSONString();
        logger.info("inPatientId={},住院手术记录信息加密前数据beforeEncryptData={}", medicalInhospitalOperationRecordVo.getInhospitalSerialNo(),beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }


    public static String encryptMedicalInhospitalDiagnosisVo(MedicalInhospitalDiagnosisVo medicalInhospitalDiagnosisVo, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);

        info.put("inhospital_serial_no", medicalInhospitalDiagnosisVo.getInhospitalSerialNo());
        info.put("patient_id", medicalInhospitalDiagnosisVo.getPatientId());
        info.put("inhospital_no", medicalInhospitalDiagnosisVo.getInhospitalNo());
        info.put("inhospital_times", medicalInhospitalDiagnosisVo.getInhospitalTimes());
        info.put("hospital_no", medicalInhospitalDiagnosisVo.getHospitalNo());
        info.put("hospital_name", medicalInhospitalDiagnosisVo.getHospitalName());
        info.put("medical_institution_type", medicalInhospitalDiagnosisVo.getMedicalInstitutionType());
        info.put("medical_category", medicalInhospitalDiagnosisVo.getMedicalCategory());


        info.put("inhospital_doctor_no", medicalInhospitalDiagnosisVo.getInhospitalDoctorNo());
        info.put("inhospital_doctor_name", medicalInhospitalDiagnosisVo.getInhospitalDoctorName());
        info.put("attending_doctor_no", medicalInhospitalDiagnosisVo.getAttendingDoctorNo());
        info.put("attending_doctor_name", medicalInhospitalDiagnosisVo.getAttendingDoctorName());
        info.put("inhospital_date", medicalInhospitalDiagnosisVo.getInhospitalDate());
        info.put("in_dept_date", medicalInhospitalDiagnosisVo.getInDeptDate());
        info.put("inhospital_reason", medicalInhospitalDiagnosisVo.getInhospitalReason());
        info.put("inhospital_dept_name", medicalInhospitalDiagnosisVo.getInhospitalDeptName());
        info.put("inhospital_dept_no", medicalInhospitalDiagnosisVo.getInhospitalDeptNo());
        info.put("bed_no", medicalInhospitalDiagnosisVo.getBedNo());

        info.put("leave_hospital_date", medicalInhospitalDiagnosisVo.getLeaveHospitalDate());
        info.put("dead_date", medicalInhospitalDiagnosisVo.getDeadDate());
        info.put("inhospital_diag_no", medicalInhospitalDiagnosisVo.getInhospitalDiagNo());
        info.put("inhospital_diag_name", medicalInhospitalDiagnosisVo.getInhospitalDiagName());

        info.put("inhospital_diag_doctor_no", medicalInhospitalDiagnosisVo.getInhospitalDiagDoctorNo());
        info.put("inhospital_diag_doctor_name", medicalInhospitalDiagnosisVo.getInhospitalDoctorName());
        info.put("medical_history_statement", medicalInhospitalDiagnosisVo.getMedicalHistoryStatement());
        info.put("present_disease_history", medicalInhospitalDiagnosisVo.getPresentDiseaseHistory());

        info.put("anamnesis", medicalInhospitalDiagnosisVo.getAnamnesis());
        info.put("obstetrical_history", medicalInhospitalDiagnosisVo.getObstetricalHistory());
        info.put("personal_history", medicalInhospitalDiagnosisVo.getPersonalHistory());
        info.put("family_history", medicalInhospitalDiagnosisVo.getFamilyHistory());
        info.put("physical_check", medicalInhospitalDiagnosisVo.getPhysicalCheck());
        info.put("speciality_check", medicalInhospitalDiagnosisVo.getSpecialityCheck());
        info.put("accessory_check", medicalInhospitalDiagnosisVo.getAccessoryCheck());
        info.put("treat_recormend", medicalInhospitalDiagnosisVo.getTreatRecormend());
        info.put("leave_hospital_reason", medicalInhospitalDiagnosisVo.getLeaveHospitalReason());
        info.put("leave_hos_disease_no", medicalInhospitalDiagnosisVo.getLeaveHosDiseaseNo());
        info.put("leave_hos_disease_name", medicalInhospitalDiagnosisVo.getLeaveHosDiseaseName());
        info.put("leave_doc_suggest", medicalInhospitalDiagnosisVo.getLeaveDocSuggest());
        info.put("sec_diag_no1", medicalInhospitalDiagnosisVo.getSecDiagNo1());
        info.put("sec_diag_name1", medicalInhospitalDiagnosisVo.getSecDiagName1());
        info.put("sec_diag_no2", medicalInhospitalDiagnosisVo.getSecDiagNo2());
        info.put("sec_diag_name2", medicalInhospitalDiagnosisVo.getSecDiagName2());

        info.put("sec_diag_no3", medicalInhospitalDiagnosisVo.getSecDiagNo3());
        info.put("sec_diag_name3", medicalInhospitalDiagnosisVo.getSecDiagName3());
        info.put("sec_diag_no4", medicalInhospitalDiagnosisVo.getSecDiagNo4());
        info.put("sec_diag_name4", medicalInhospitalDiagnosisVo.getSecDiagName4());


        info.put("chief_doctor_no", medicalInhospitalDiagnosisVo.getChiefDoctorNo());
        info.put("chief_doctor_name", medicalInhospitalDiagnosisVo.getChiefDoctorName());
        info.put("inhospital_way_name", medicalInhospitalDiagnosisVo.getInhospitalWayName());
        info.put("inhospital_reason", medicalInhospitalDiagnosisVo.getInhospitalReason());
        info.put("inhospital_area", medicalInhospitalDiagnosisVo.getInhospitalArea());
        info.put("leave_hospital_dept_name", medicalInhospitalDiagnosisVo.getLeaveHospitalDeptName());
        info.put("leave_hospital_dept_no", medicalInhospitalDiagnosisVo.getLeaveHospitalDeptNo());
        info.put("dead_date", medicalInhospitalDiagnosisVo.getDeadDate());
        info.put("death_cause_name", medicalInhospitalDiagnosisVo.getDeathCauseName());
        info.put("inhospital_diag_doctor_no", medicalInhospitalDiagnosisVo.getInhospitalDiagDoctorNo());
        info.put("inhospital_diag_doctor_name", medicalInhospitalDiagnosisVo.getInhospitalDiagDoctorName());
        info.put("inhospital_ins_diag_no", medicalInhospitalDiagnosisVo.getInhospitalInsDiagNo());
        info.put("inhospital_ins_diag_name", medicalInhospitalDiagnosisVo.getInhospitalInsDiagName());
        info.put("allergic_history", medicalInhospitalDiagnosisVo.getAllergicHistory());
        info.put("menstrual_history", medicalInhospitalDiagnosisVo.getMenstrualHistory());
        info.put("leave_hos_ins_diag_no", medicalInhospitalDiagnosisVo.getLeaveHosInsDiagNo());
        info.put("leave_hos_ins_diag_name", medicalInhospitalDiagnosisVo.getLeaveHosInsDiagName());
        info.put("complication", medicalInhospitalDiagnosisVo.getComplication());
        info.put("intensive_ward_checkin_date", medicalInhospitalDiagnosisVo.getIntensiveWardCheckinDate());
        info.put("intensive_ward_checkout_date", medicalInhospitalDiagnosisVo.getIntensiveWardCheckoutDate());
        info.put("inhospital_days", medicalInhospitalDiagnosisVo.getInhospitalDays());
        info.put("electronic_medical_records", medicalInhospitalDiagnosisVo.getElectronicMedicalRecords());

        info.put("case_no", medicalInhospitalDiagnosisVo.getCaseNo());
        info.put("rows", medicalInhospitalDiagnosisVo.getTotalRows());
        info.put("offset", medicalInhospitalDiagnosisVo.getCurrentOffset());
        String beforeEncryptData = sceneData.toJSONString();

        logger.info("inpatientId ={},住院诊断信息加密前数据beforeEncryptData={}",medicalInhospitalDiagnosisVo.getInhospitalSerialNo(), beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }

    public static String encryptMedicalOutlineData(MedicalPatient medicalPatient, Integer totalRecordNum, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);
        info.put("case_no", medicalPatient.getCaseNo());
        info.put("serial_no", medicalPatient.getMzFeeId());
        info.put("medical_type", "O");
        info.put("patient_id", medicalPatient.getPatId());
        info.put("visit_date", medicalPatient.getVisitTime());
        info.put("hospital_id", medicalPatient.getHospitalId());
        info.put("status", "Y");
        info.put("total_record_num", totalRecordNum);
        String beforeEncryptData = sceneData.toJSONString();
        logger.info("mzFeeId={},门诊就诊数据概要加密前数据beforeEncryptData={}",medicalPatient.getMzFeeId(), beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }

    public static String encryptMedicalInvoiceNo(MedicalInvoiceNo medicalInvoiceNo,String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);
        info.put("case_no", medicalInvoiceNo.getCaseNo());
        info.put("serial_no", medicalInvoiceNo.getMzFeeId());
        info.put("medical_type", "O");
        info.put("pay_no", medicalInvoiceNo.getPayFeeId());
        info.put("org_invoice_no", medicalInvoiceNo.getOrgInvoiceNo());
        info.put("final_invoice_no", medicalInvoiceNo.getFinalInvoiceNo());
        info.put("offset", medicalInvoiceNo.getCurrentOffset());
        info.put("rows", medicalInvoiceNo.getTotalRows());
        String beforeEncryptData = sceneData.toJSONString();
        logger.info("mzFeeId={},门诊发票编号补传加密前数据beforeEncryptData={}",medicalInvoiceNo.getMzFeeId(), beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }

    public static String encryptMedicalOutlineInhospitalData(MedicalPatient medicalPatient, Integer totalRecordNum, String encryptKey) throws AlipayApiException {
        JSONObject sceneData = new JSONObject();
        JSONArray infoArray = new JSONArray();
        sceneData.put("info", infoArray);
        JSONObject info = new JSONObject();
        infoArray.add(info);
        info.put("case_no", medicalPatient.getCaseNo());
        info.put("serial_no", StringUtils.isNotEmpty(medicalPatient.getInpatientId())?medicalPatient.getInpatientId():medicalPatient.getAdmissionNo()+"_"+medicalPatient.getInTime());
        info.put("medical_type", "I");
        info.put("patient_id", medicalPatient.getPatId());
        info.put("visit_date", medicalPatient.getVisitTime());
        info.put("hospital_id", medicalPatient.getHospitalId());
        info.put("status", "Y");
        info.put("total_record_num", totalRecordNum);
        String beforeEncryptData = sceneData.toJSONString();
        logger.info("inPatientId={},住院就诊数据概要加密前数据beforeEncryptData={}", medicalPatient.getInpatientId(),beforeEncryptData);
        String afterEncryptData = AlipayEncrypt.encryptContent(beforeEncryptData, "AES", encryptKey, "utf8");
        return afterEncryptData;
    }


    public static AlipayCommerceDataSendResponse executeUploadMessage(SbRequest sbRequest) throws Exception {

        String appId = Constant.APP_ID;
        String privateKey =Constant.PRIVATE_KEY;
        String bizContent = "{\n" +
                "    \"channel\": \"SzZyy\",\n" +
                "    \"op_code\": \"data_save\",\n" +
                "    \"scene_code\": \"" +
                sbRequest.getSceneCode() +
                "\",\n" +
                "    \"version\": \"1.0\",\n" +
                "    \"scene_data\": {\n" +
                "        \"security\": [\n" +
                "            {\n" +
                "                \"encrypt_info\": \"" + sbRequest.getEncryptData() + "\"" +
                "            }\n" +
                "        ]\n" +
                "    }\n" +
                "}";
        logger.info("发给支付宝的参数为={}", bizContent);
        AlipayClient alipayClient = new DefaultAlipayClient(Constant.ALI_URL, appId, privateKey, "json", "utf-8");
        AlipayCommerceDataSendRequest request = new AlipayCommerceDataSendRequest();
        request.setBizContent(bizContent);
        AlipayCommerceDataSendResponse response = alipayClient.execute(request);
        return response;
    }

    private static Double conveterIntToDouble(Integer value) {
        value = value==null?0:value;
        Double result = value / 100d;
        return result;
    }
}
